<?php session_start();?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Triumph - Add New Employee</title>
        <link href="maintenancePagesCSS.css" REL="StyleSheet" TYPE="text/css" >
    </head>
    <body>
       
    <center>
      <form method="post" id="frmPostCustomer" action="AddEmployeeFunct.php">
               <table width="1000" height="606" border="0" background="images/background.jpg">
            <tr>
              <th height="602" bgcolor="#454343" scope="col"><p><span style="font-family: Arial"><img src="images/TitleAddEmployee.gif" alt="Add Employee" width="514" height="67"></span></p>
                <table class="EditTable">
                <tr>
                  <th align="right">*Last Name:&nbsp;&nbsp; </th>
                  <td><input type="text" id="txtEmployeeLastName" name="txtEmployeeLastName" maxlength="45" />
                  </td>
                </tr>
                <tr>
                  <th align="right">*First Name:&nbsp;&nbsp; </th>
                  <td><input type="text" id="txtEmployeeFirstName" name="txtEmployeeFirstName" maxlength="45" />
                  </td>
                </tr>
                <tr>
                  <th align="right">*Login ID:&nbsp;&nbsp; </th>
                  <td><input type="text" id="txtLoginID" name="txtLoginID" maxlength="15"/>
                  </td>
                </tr>
                <tr>
                  <th align="right">*Password:&nbsp;&nbsp; </th>
                  <td><input type="password" id="txtEmployeePwd" name="txtEmployeePwd" maxlength="25" />
                  </td>
                </tr>
                <tr>
                  <th align="right">*Confirm Password:&nbsp;&nbsp; </th>
                  <td><input type="password" id="txtEmployeePwdConfirm" name="txtEmployeePwdConfirm" maxlength="25"/>
                  </td>
                </tr>
                <tr>
                  <th align="right">*Role:&nbsp;&nbsp; </th>
                  <td><select name="selRole" id="selRole">
                      <option selected="true" value="Admin"> Admin </option>
                      <option value="User"> User </option>
                    </select>
                  </td>
                </tr>
              </table>
                <br/>
                <br/>
                <input name="button" type="button" onClick="submitAddEmp();" value="Submit" />
                <input name="reset" type="reset" value="Clear" />
				
				 <br>
                <br>
                <font style="font-size: smaller; font-style: italic ">*denotes required field</font> <BR><BR>
                <script src="links.js" language="javascript" type="text/javascript"></script>
                <script type="text/javascript">
            writeEmployeeLinks("", "");
                </script>
			  </th>
            </tr>
        </table>
      </form>
        </center>
    </body>
    <script type="text/javascript">
        function submitAddEmp()
        {
            var strCorrect = "Please correct the following errors:\n";
            var strCompare = strCorrect;
            strCorrect += checkPW();
            strCorrect += checkFields();
            if(strCorrect == strCompare)
            {
               document.getElementById("frmPostCustomer").submit();
            }
            else
            {
                alert(strCorrect);
            }
        }

        function checkPW()
        {
            var pw1 = document.getElementById("txtEmployeePwd");
            var pw2 = document.getElementById("txtEmployeePwdConfirm");
            if(pw1.value != pw2.value)
            {
                return  "  - Passwords do not match\n";
            }
            else
            {
                return "";
            }
        }
        function checkFields()
        {
            var str = "";

            str += (document.getElementById("txtEmployeeLastName").value == "") ? "  - Last Name is Blank\n" : "";

            str += (document.getElementById("txtEmployeeFirstName").value == "") ? "  - First Name is Blank\n" : "";
            
            str += (document.getElementById("txtLoginID").value == "") ? "  - User ID is Blank\n" : "";

            str += (document.getElementById("txtEmployeePwd").value == "") ? "  - Password is Blank\n" : "";

            str += (document.getElementById("txtEmployeePwdConfirm").value == "") ? "  - Confirm Password is Blank\n" : "";

            str += (document.getElementById("txtEmployeePwd").value.length < 5) ? "  - Passwords must be at least five chararacters long\n" : "";
            

            return str;
        }

      
    </script>
</html>
